<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue1</title>
</head>

<body>
    <div id="app">
        <h1>{{ msg }}</h1>
    </div>
    <div id="app2">
        <h1></h1>
    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
<script>
    // 实例化Vue对象
    let app = new Vue({
        el: '#app',         // Vue对象在页面中的作用容器
        // 当前Vue对象设置的默认数据
        data: {
            msg: '好好学习，天天向上。'
        },
        created: () => {
            console.log('created')
        },
        beforeCreate: () => {
            console.log('beforeCreate')
        },

    })

    let app2 = document.getElementById('app2')
    let h1 = app2.getElementsByTagName('h1')[0]
    h1.innerText = '好好学习，天天向上。'
</script>

</html>